package com.kly.sc.api.infras.utils;


import com.kly.sc.api.infras.enums.RestCodeEnum;
import com.kly.sc.api.infras.exception.ApplicationException;
import com.fqgj.exception.enums.ErrorCodeEnum;

import javax.validation.constraints.NotNull;

public class ParamsValidateUtil {

    public static void checkParams(boolean checkResult, String resultDesc) {
        if (checkResult) {
            throw new ApplicationException(RestCodeEnum.SYSTEM_PARAMETER_ERROR.setDesc(resultDesc));
        }
    }

    public static void checkParams(boolean checkResult, @NotNull ErrorCodeEnum errorCodeEnum) {
        if (checkResult) {
            throw new ApplicationException(errorCodeEnum);
        }
    }
}
